﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NewsPub;
using NewLife.Web;
using XCode;

public partial class Template_list : MyPageBase
{
    /// <summary>编号</summary>
    public Int32 EntityID { get { return WebHelper.RequestInt("id"); } }

    private Classis _Entity;
    /// <summary>客户</summary>
    public Classis Entity
    {
        get { return _Entity ?? (_Entity = Classis.FindByID(EntityID)); }
        set { _Entity = value; }
    }
    int pageSize = 20;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            DataBind();

            
            //int sid = WebHelper.RequestInt("sid"); int id = WebHelper.RequestInt("id");
            EntityList<Details> delist = null;
            delist = Details.FindAllByClassisID(Entity.ID);
            //delist=Details.FindAll("ClassisId", Entity.ID, 0, 5);
            //delist = Details.FindAll("select * from details where classisid in (select id from classis where parentid=" + EntityID + " or id=" + EntityID + ") limit 0,5");
            //delist = Details.SearchList(EntityID.ToString(), "CreateTime desc", 0, pageSize);
            //按创建时间反排序
            //delist.Sort("CreateTime", true);

            rptlist.DataSource = delist;
            rptlist.DataBind();
            //pager.PageSize = pageSize;
            //pager.TotalRowCount = Details.FindCountByName("ClassisID",Entity.ID,"Createtime Desc",0,0);// .FindCount.SearchListCount(EntityID.ToString(), "CreateTime DESC", 0, 0);
            //if (pager.TotalRowCount <= pageSize) pager.Visible = false;
            //else { delist = Details.FindAll("select * from details where classisid=" + id); delist.Sort("CreateTime", true); rptlist.DataSource = delist; rptlist.DataBind(); }
            //rptcategorylist.DataSource
            //Classis.FindAllByParent
        }
    }
}